import 'dart:convert';

///基础模型
class BaseModel {
  late int code;
  late String msg;
  dynamic data;

  BaseModel({this.code = 0, this.msg = "未知错误", this.data});

  BaseModel.fromJson(Map<String, dynamic> json) {
    code = json['code'] ?? 0;
    msg = json['msg'] ?? "";
    if (json["data"] != null && json["data"] is Map) {
      data = json["data"];
    } else {
      data =json["data"] ;
    }
  }

  @override
  String toString() {
    super.toString();
    return "请求结果==》》 code:$code,msg:$msg,data:${jsonEncode(data??{})}";
  }
}
